﻿@model StudyOnline.Models.Instructor

@{
    ViewBag.Title = "Create";
}

<h2>Create</h2>


@using (Html.BeginForm()) 
{
    @Html.AntiForgeryToken()
    
    <div class="form-horizontal">
        <h4>Instructor</h4>
        <hr />
        @Html.ValidationSummary(true, "", new { @class = "text-danger" })
        <div class="form-group">
            @Html.LabelFor(model => model.LastName, htmlAttributes: new { @class = "control-label col-md-2" })
            <div class="col-md-10">
                @Html.EditorFor(model => model.LastName, new { htmlAttributes = new { @class = "form-control" } })
                @Html.ValidationMessageFor(model => model.LastName, "", new { @class = "text-danger" })
            </div>
        </div>

        <div class="form-group">
            @Html.LabelFor(model => model.FirstName, htmlAttributes: new { @class = "control-label col-md-2" })
            <div class="col-md-10">
                @Html.EditorFor(model => model.FirstName, new { htmlAttributes = new { @class = "form-control" } })
                @Html.ValidationMessageFor(model => model.FirstName, "", new { @class = "text-danger" })
            </div>
        </div>

        <div class="form-group">
            @Html.LabelFor(model => model.Gender, htmlAttributes: new { @class = "control-label col-md-2" })
            <div class="col-md-10">
                @Html.EnumDropDownListFor(model => model.Gender, htmlAttributes: new { @class = "form-control" })
                @Html.ValidationMessageFor(model => model.Gender, "", new { @class = "text-danger" })
            </div>
        </div>

        <div class="form-group">
            @Html.LabelFor(model => model.Picture, htmlAttributes: new { @class = "control-label col-md-2" })
            <div class="col-md-10">
                @Html.EditorFor(model => model.Picture, new { htmlAttributes = new { @class = "form-control" } })
                @Html.ValidationMessageFor(model => model.Picture, "", new { @class = "text-danger" })
            </div>
        </div>

        <div class="form-group">
            @Html.LabelFor(model => model.Slogan, htmlAttributes: new { @class = "control-label col-md-2" })
            <div class="col-md-10">
                @Html.EditorFor(model => model.Slogan, new { htmlAttributes = new { @class = "form-control" } })
                @Html.ValidationMessageFor(model => model.Slogan, "", new { @class = "text-danger" })
            </div>
        </div>

        <div class="form-group">
            @Html.LabelFor(model => model.Price_OneHour, htmlAttributes: new { @class = "control-label col-md-2" })
            <div class="col-md-10">
                @Html.EditorFor(model => model.Price_OneHour, new { htmlAttributes = new { @class = "form-control" } })
                @Html.ValidationMessageFor(model => model.Price_OneHour, "", new { @class = "text-danger" })
            </div>
        </div>

        <div class="form-group">
            @Html.LabelFor(model => model.SchoolID, "SchoolID", htmlAttributes: new { @class = "control-label col-md-2" })
            <div class="col-md-10">
                @Html.DropDownList("SchoolID", null, htmlAttributes: new { @class = "form-control" })
                @Html.ValidationMessageFor(model => model.SchoolID, "", new { @class = "text-danger" })
            </div>
        </div>

        <div class="form-group">
            <div class="col-md-offset-2 col-md-10">
                <table>
                    <tr>
                        @{
    int cnt = 0;
   

    foreach (var grade in ViewBag.Grades)
    {
        if (cnt++ % 3 == 0)
        {
            @:</tr> <tr>
        }
                                @:<td>
                                    <input type="checkbox"
                                           name="selectedGrades"
                                           value="@grade.GradeID"
                                           />
                                    @grade.GradeID @:  @grade.GradeName
                                    @:</td>
                            }
                            @:</tr>
                        }
                    </table>
                </div>
            </div>

        <div class="form-group">
            <div class="col-md-offset-2 col-md-10">
                <table>
                    <tr>
                        @{
    int cnt_subjects = 0;


    foreach (var Subject in ViewBag.Subjects)
    {
        if (cnt_subjects ++ % 3 == 0)
        {
            @: </tr> <tr>
        }
        @:<td>
                    <input type="checkbox"
                           name="selectedSubjects"
                           value="@Subject.SubjectID" />
                            @Subject.SubjectID @:  @Subject.SubjectName
                            @: </td>
                            }
                            @: </tr>
                        }
                    </table>
                </div>
            </div>


        <div class="form-group">
            <div class="col-md-offset-2 col-md-10">
                <input type="submit" value="Create" class="btn btn-default" />
            </div>
        </div>
    </div>
}

<div>
    @Html.ActionLink("Back to List", "Index")
</div>

@section Scripts {
    @Scripts.Render("~/bundles/jqueryval")
}
